package com.hzsai.utils;

import java.io.Serializable;

//@Data
//@Accessors(chain=true)
//@ApiModel(value = "ResultMsg", description = "返回消息体")
/**
 *

 * @author suzhenyin
 * @date 2019/5/20 17:09
 */
public class ResultMsg implements Serializable {

    public ResultMsg() {
    }

    //@ApiModelProperty(value = "错误码",dataType = "Integer",example = "200")
    private Integer code;

    /**
     * 提示信息
     */
    //@ApiModelProperty(value = "提示信息",dataType = "String",example = "返回成功")
    private String msg;

    /**
     * 具体内容
     */
    //@ApiModelProperty(value = "具体内容",dataType = "T",example = "Object")
    private  Object data;

    public static ResultMsg success(Object object){
        ResultMsg msg=new ResultMsg();
        msg.setCode(200);
        msg.setMsg("请求成功");
        msg.setData(object);
        return msg;
    }

    public static ResultMsg success(){
        return success(null);
    }

    public static ResultMsg error(Integer code,String resultmsg){
        ResultMsg msg=new ResultMsg();
        msg.setCode(code);
        msg.setMsg(resultmsg);
        return msg;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
